package cn.monkey.family.server.domain.uc.auth;

import cn.monkey.family.data.uc.auth.AuthRequest;
import cn.monkey.family.data.context.RequestContext;

import java.util.List;

public class DefaultAuthorizeFilterChain implements AuthorizeFilterChain {

    protected final List<AuthorizeFilter> filters;

    public DefaultAuthorizeFilterChain(List<AuthorizeFilter> filters) {
        this.filters = filters;
    }

    @Override
    public void doFilter(RequestContext requestContext, AuthRequest authRequest) {
        for (AuthorizeFilter filter : filters) {
            filter.doFilter(requestContext, authRequest, this);
        }
    }
}
